20bba5
@@ -307,9 +307,6 @@
public String getTokenStrForm() throws IOException {
 
   public void close() {
     isConnected = false;
-    if ((transport != null) && transport.isOpen()) {
-      transport.close();
-    }
     try {
       if (null != client) {
         client.shutdown();
@@ -317,6 +314,11 @@
public void close() {
     } catch (TException e) {
       LOG.error("Unable to shutdown local metastore client", e);
     }
+    // Transport would have got closed via client.shutdown(), so we dont need this, but
+    // just in case, we make this call.
+    if ((transport != null) && transport.isOpen()) {
+      transport.close();
+    }
   }
 
   /**
